<?php

//define the path and make sure that PHP can write to it (for SQLite)
$path = dirname(__FILE__);

//require nessecary files for the application
require_once($path.'/config.php');
//require_once($path.'/functions.php');

//require nessecary files for the framework
require_once(PICORA_DIR.'picora.php');

//setup autoloader
PicoraAutoLoader::addFolder($path.'/controllers/');
PicoraAutoLoader::addFolder($path.'/classes/');

//add routes defined in config.php
PicoraDispatcher::addRoute($routes);

//run the dispatcher
print PicoraDispatcher::dispatch($path,BASE_URL,(isset($_GET['__route__']) ? '/'.$_GET['__route__'] : '/'));
?>